import request from '@/utils/XHRrequest'

// GET请求
request.get('/api/data', { id: 123 })
  .then(response => console.log(response))
  .catch(error => console.error(error))

// POST请求
request.post('/api/save', { name: 'test' })
  .then(response => console.log(response))
  .catch(error => console.error(error))

// 自定义请求头
request.setHeaders({
  'Authorization': 'Bearer token123'
}).get('/api/protected')